package client.comm.baoding.ui.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import client.comm.commlib.network.data.JsonResult
import client.comm.commlib.network.data.Ret
import client.comm.commlib.out_time
import client.comm.commlib.toast.toast
import client.comm.baoding.ui.viewmodel.MiddleVm
import client.comm.baoding.api.bean.UserInfo
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import retrofit2.Response

class PaiduiViewModel(val app: Application) : MiddleVm(app) {
    val signRet = MutableLiveData<JsonResult<Ret>>()
    val isShowing = MutableLiveData<Boolean>(false)
    val orderId = MutableLiveData<String>()

    val btnEnable = MutableLiveData<Boolean>(true)
    val btnTxt = MutableLiveData<String>("")
    val btnShowEnable = MutableLiveData<Boolean>(true)


    fun sign() {

        isShowing.value = true
        hold({
            server.signOrder(orderId.value)
        }, success = {
            signRet.value = it
        }, complete = {
            isShowing.value = false
        })
    }



}